package com.myboot.springbootmybatis.controller;

import com.myboot.springbootmybatis.pojo.Student;
import com.myboot.springbootmybatis.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@Transactional
public class StudentController {
    @Autowired
    private StudentService studentService;

    @GetMapping("/student")
    @ResponseBody
    public String queryStudentById(Integer id){
        Student student = studentService.queryById(id);
        return student.toString();
    }
}
